package com.sc.nft.entity.vo.ecology;

import cn.hutool.core.util.StrUtil;
import com.sc.nft.enums.EcologyRewardsType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class AdminUserEcologyHatchRcordsDetailsVO {

    @ApiModelProperty(value = "ECOLOGY_POINTS:生态燃料 EQUITY_PROPS:权益道具")
    private EcologyRewardsType rewardsType;

    @ApiModelProperty(value = "奖励名称")
    private String linkName;

    @ApiModelProperty(value = "奖励数量")
    private String linkCount;


    public void setLinkCount(BigDecimal linkCount) {
        if(rewardsType == EcologyRewardsType.ECOLOGY_POINTS){
            this.linkCount = linkCount.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();
        }

        if(rewardsType == EcologyRewardsType.EQUITY_PROPS){
            this.linkCount = linkCount.stripTrailingZeros().toPlainString();
        }
    }

}
